from django.db import models

from fbase.models import NameObject


class Company(NameObject):
    class Meta:
        verbose_name_plural = '公司表'
        verbose_name = verbose_name_plural


class BusinessDept(NameObject):
    class Meta:
        verbose_name_plural = '事业部'
        verbose_name = verbose_name_plural


class BusinessLine(NameObject):
    businessdept = models.ForeignKey('BusinessDept', on_delete=models.PROTECT)

    class Meta:
        verbose_name_plural = '业务线'
        verbose_name = verbose_name_plural


class Employee(NameObject):
    emp_number = models.CharField(max_length=128)
    company = models.ForeignKey('Company', on_delete=models.PROTECT)
    businessdept = models.ForeignKey('BusinessDept', on_delete=models.PROTECT)
    businessline = models.ManyToManyField('BusinessLine')

    class Meta:
        verbose_name_plural = '员工表'
        verbose_name = verbose_name_plural
